home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevMac / CIncludes / QD3DViewer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  14.0 KB  |  463 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DViewer.h
  3.  
  4.      Contains:    MacOS Viewer Controller Interface File.                                
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3DVIEWER__
  19. #define __QD3DVIEWER__
  20.  
  21. #ifndef __QD3D__
  22. #include <QD3D.h>
  23. #endif
  24. #ifndef __QD3DGROUP__
  25. #include <QD3DGroup.h>
  26. #endif
  27.  
  28. #if TARGET_OS_MAC
  29. #ifndef __EVENTS__
  30. #include <Events.h>
  31. #endif
  32. #ifndef __MACTYPES__
  33. #include <MacTypes.h>
  34. #endif
  35. #ifndef __QUICKDRAW__
  36. #include <Quickdraw.h>
  37. #endif
  38. #endif  /* TARGET_OS_MAC */
  39.  
  40.  
  41.  
  42. #if PRAGMA_ONCE
  43. #pragma once
  44. #endif
  45.  
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49.  
  50. #if PRAGMA_IMPORT
  51. #pragma import on
  52. #endif
  53.  
  54. #if PRAGMA_STRUCT_ALIGN
  55.     #pragma options align=power
  56. #elif PRAGMA_STRUCT_PACKPUSH
  57.     #pragma pack(push, 2)
  58. #elif PRAGMA_STRUCT_PACK
  59.     #pragma pack(2)
  60. #endif
  61.  
  62. #if PRAGMA_ENUM_ALWAYSINT
  63.     #pragma enumsalwaysint on
  64. #elif PRAGMA_ENUM_OPTIONS
  65.     #pragma option enum=int
  66. #elif PRAGMA_ENUM_PACK
  67.     #if __option(pack_enums)
  68.         #define PRAGMA_ENUM_PACK__QD3DVIEWER__
  69.     #endif
  70.     #pragma options(!pack_enums)
  71. #endif
  72.  
  73. #if TARGET_OS_MAC
  74. typedef void *                            TQ3ViewerObject;
  75. typedef CALLBACK_API_C( OSErr , TQ3ViewerDrawingCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  76.  
  77. enum {
  78.     kQ3ViewerShowBadge            = 1 << 0,
  79.     kQ3ViewerActive                = 1 << 1,
  80.     kQ3ViewerControllerVisible    = 1 << 2,
  81.     kQ3ViewerDrawFrame            = 1 << 3,
  82.     kQ3ViewerDraggingOff        = 1 << 4,
  83.     kQ3ViewerButtonCamera        = 1 << 5,
  84.     kQ3ViewerButtonTruck        = 1 << 6,
  85.     kQ3ViewerButtonOrbit        = 1 << 7,
  86.     kQ3ViewerButtonZoom            = 1 << 8,
  87.     kQ3ViewerButtonDolly        = 1 << 9,
  88.     kQ3ViewerButtonReset        = 1 << 10,
  89.     kQ3ViewerOutputTextMode        = 1 << 11,
  90.     kQ3ViewerDragMode            = 1 << 12,
  91.     kQ3ViewerDrawGrowBox        = 1 << 13,
  92.     kQ3ViewerDrawDragBorder        = 1 << 14,
  93.     kQ3ViewerDraggingInOff        = 1 << 15,
  94.     kQ3ViewerDraggingOutOff        = 1 << 16,
  95.     kQ3ViewerDefault            = 1 << 31
  96. };
  97.  
  98.  
  99. enum {
  100.     kQ3ViewerEmpty                = 0,
  101.     kQ3ViewerHasModel            = 1 << 0,
  102.     kQ3ViewerHasUndo            = 1 << 1
  103. };
  104.  
  105.  
  106. enum TQ3ViewerCameraView {
  107.     kQ3ViewerCameraRestore        = 0,
  108.     kQ3ViewerCameraFit            = 1,
  109.     kQ3ViewerCameraFront        = 2,
  110.     kQ3ViewerCameraBack            = 3,
  111.     kQ3ViewerCameraLeft            = 4,
  112.     kQ3ViewerCameraRight        = 5,
  113.     kQ3ViewerCameraTop            = 6,
  114.     kQ3ViewerCameraBottom        = 7
  115. };
  116. typedef enum TQ3ViewerCameraView TQ3ViewerCameraView;
  117.  
  118.  
  119. /******************************************************************************
  120.  **                                                                             **
  121.  **        Return viewer version number                                         **
  122.  **                                                                             **
  123.  *****************************************************************************/
  124. EXTERN_API_C( OSErr )
  125. Q3ViewerGetVersion                (unsigned long *        majorRevision,
  126.                                  unsigned long *        minorRevision);
  127.  
  128.  
  129.  
  130. /******************************************************************************
  131.  **                                                                             **
  132.  **        Return viewer release version number                                 **
  133.  **        (in 'vers' format - e.g. 0x01518000 ==> 1.5.1 release)                 **
  134.  **                                                                             **
  135.  *****************************************************************************/
  136. EXTERN_API_C( OSErr )
  137. Q3ViewerGetReleaseVersion        (unsigned long *        releaseRevision);
  138.  
  139.  
  140. /******************************************************************************
  141.  **                                                                             **
  142.  **                        Creation and destruction                             **
  143.  **                Note that this is not a QuickDraw 3D object                     **
  144.  **                                                                             **
  145.  *****************************************************************************/
  146. EXTERN_API_C( TQ3ViewerObject )
  147. Q3ViewerNew                        (CGrafPtr                 port,
  148.                                  Rect *                    rect,
  149.                                  unsigned long             flags);
  150.  
  151. EXTERN_API_C( OSErr )
  152. Q3ViewerDispose                    (TQ3ViewerObject         theViewer);
  153.  
  154. /******************************************************************************
  155.  **                                                                             **
  156.  **                    Functions to attach data to a viewer                     **
  157.  **                                                                             **
  158.  *****************************************************************************/
  159. EXTERN_API_C( OSErr )
  160. Q3ViewerUseFile                    (TQ3ViewerObject         theViewer,
  161.                                  long                     refNum);
  162.  
  163. EXTERN_API_C( OSErr )
  164. Q3ViewerUseData                    (TQ3ViewerObject         theViewer,
  165.                                  void *                    data,
  166.                                  long                     size);
  167.  
  168. /******************************************************************************
  169.  **                                                                             **
  170.  **        Functions to write data out from the Viewer                             **
  171.  **                                                                             **
  172.  *****************************************************************************/
  173. EXTERN_API_C( OSErr )
  174. Q3ViewerWriteFile                (TQ3ViewerObject         theViewer,
  175.                                  long                     refNum);
  176.  
  177. EXTERN_API_C( unsigned long )
  178. Q3ViewerWriteData                (TQ3ViewerObject         theViewer,
  179.                                  Handle                 data);
  180.  
  181. /******************************************************************************
  182.  **                                                                             **
  183.  **        Use this function to force the Viewer to re-draw                     **
  184.  **                                                                             **
  185.  *****************************************************************************/
  186. EXTERN_API_C( OSErr )
  187. Q3ViewerDraw                    (TQ3ViewerObject         theViewer);
  188.  
  189. EXTERN_API_C( OSErr )
  190. Q3ViewerDrawContent                (TQ3ViewerObject         theViewer);
  191.  
  192. EXTERN_API_C( OSErr )
  193. Q3ViewerDrawControlStrip        (TQ3ViewerObject         theViewer);
  194.  
  195. /******************************************************************************
  196.  **                                                                             **
  197.  **        Function used by the Viewer to filter and handle events                 **
  198.  **                                                                             **
  199.  *****************************************************************************/
  200. EXTERN_API_C( Boolean )
  201. Q3ViewerEvent                    (TQ3ViewerObject         theViewer,
  202.                                  EventRecord *            evt);
  203.  
  204. /******************************************************************************
  205.  **                                                                             **
  206.  **        This function returns a PICT of the contents of the                  **
  207.  **        Viewer's window.  The application should dispose the PICT.             **
  208.  **                                                                             **
  209.  *****************************************************************************/
  210. EXTERN_API_C( PicHandle )
  211. Q3ViewerGetPict                    (TQ3ViewerObject         theViewer);
  212.  
  213. /******************************************************************************
  214.  **                                                                             **
  215.  **                        Calls for dealing with Buttons                         **
  216.  **                                                                             **
  217.  *****************************************************************************/
  218. EXTERN_API_C( OSErr )
  219. Q3ViewerGetButtonRect            (TQ3ViewerObject         theViewer,
  220.                                  unsigned long             button,
  221.                                  Rect *                    rect);
  222.  
  223. EXTERN_API_C( unsigned long )
  224. Q3ViewerGetCurrentButton        (TQ3ViewerObject         theViewer);
  225.  
  226. EXTERN_API_C( OSErr )
  227. Q3ViewerSetCurrentButton        (TQ3ViewerObject         theViewer,
  228.                                  unsigned long             button);
  229.  
  230. /******************************************************************************
  231.  **                                                                             **
  232.  **        Functions to set/get the group to be displayed by the Viewer.         **
  233.  **                                                                             **
  234.  *****************************************************************************/
  235. EXTERN_API_C( OSErr )
  236. Q3ViewerUseGroup                (TQ3ViewerObject         theViewer,
  237.                                  TQ3GroupObject         group);
  238.  
  239. EXTERN_API_C( TQ3GroupObject )
  240. Q3ViewerGetGroup                (TQ3ViewerObject         theViewer);
  241.  
  242. /******************************************************************************
  243.  **                                                                             **
  244.  **        Functions to set/get the color used to clear the window                 **
  245.  **                                                                             **
  246.  *****************************************************************************/
  247. EXTERN_API_C( OSErr )
  248. Q3ViewerSetBackgroundColor        (TQ3ViewerObject         theViewer,
  249.                                  TQ3ColorARGB *            color);
  250.  
  251. EXTERN_API_C( OSErr )
  252. Q3ViewerGetBackgroundColor        (TQ3ViewerObject         theViewer,
  253.                                  TQ3ColorARGB *            color);
  254.  
  255. /******************************************************************************
  256.  **                                                                             **
  257.  **        Getting/Setting a Viewer's View object.  Disposal is needed.         **
  258.  **                                                                             **
  259.  *****************************************************************************/
  260. EXTERN_API_C( TQ3ViewObject )
  261. Q3ViewerGetView                    (TQ3ViewerObject         theViewer);
  262.  
  263. EXTERN_API_C( OSErr )
  264. Q3ViewerRestoreView                (TQ3ViewerObject         theViewer);
  265.  
  266. /******************************************************************************
  267.  **                                                                             **
  268.  **        Calls for setting/getting viewer flags                                 **
  269.  **                                                                             **
  270.  *****************************************************************************/
  271. EXTERN_API_C( OSErr )
  272. Q3ViewerSetFlags                (TQ3ViewerObject         theViewer,
  273.                                  unsigned long             flags);
  274.  
  275. EXTERN_API_C( unsigned long )
  276. Q3ViewerGetFlags                (TQ3ViewerObject         theViewer);
  277.  
  278. /******************************************************************************
  279.  **                                                                             **
  280.  **        Calls related to bounds/dimensions.  Bounds is the size of              **
  281.  **        the window.  Dimensions can either be the Rect from the ViewHints     **
  282.  **        or the current dimensions of the window (if you do a Set).             **
  283.  **                                                                             **
  284.  *****************************************************************************/
  285. EXTERN_API_C( OSErr )
  286. Q3ViewerSetBounds                (TQ3ViewerObject         theViewer,
  287.                                  Rect *                    bounds);
  288.  
  289. EXTERN_API_C( OSErr )
  290. Q3ViewerGetBounds                (TQ3ViewerObject         theViewer,
  291.                                  Rect *                    bounds);
  292.  
  293. EXTERN_API_C( OSErr )
  294. Q3ViewerSetDimension            (TQ3ViewerObject         theViewer,
  295.                                  unsigned long             width,
  296.                                  unsigned long             height);
  297.  
  298. EXTERN_API_C( OSErr )
  299. Q3ViewerGetDimension            (TQ3ViewerObject         theViewer,
  300.                                  unsigned long *        width,
  301.                                  unsigned long *        height);
  302.  
  303. EXTERN_API_C( OSErr )
  304. Q3ViewerGetMinimumDimension        (TQ3ViewerObject         theViewer,
  305.                                  unsigned long *        width,
  306.                                  unsigned long *        height);
  307.  
  308. /******************************************************************************
  309.  **                                                                             **
  310.  **                            Port related calls                                 **
  311.  **                                                                             **
  312.  *****************************************************************************/
  313. EXTERN_API_C( OSErr )
  314. Q3ViewerSetPort                    (TQ3ViewerObject         theViewer,
  315.                                  CGrafPtr                 port);
  316.  
  317. EXTERN_API_C( CGrafPtr )
  318. Q3ViewerGetPort                    (TQ3ViewerObject         theViewer);
  319.  
  320. /******************************************************************************
  321.  **                                                                             **
  322.  **        Adjust Cursor should be called from idle loop to allow the Viewer     **
  323.  **        to change the cursor according to the cursor position/object under     **
  324.  **        the cursor.                                                             **
  325.  **                                                                             **
  326.  *****************************************************************************/
  327. EXTERN_API_C( Boolean )
  328. Q3ViewerAdjustCursor            (TQ3ViewerObject         theViewer,
  329.                                  Point *                pt);
  330.  
  331. EXTERN_API_C( OSErr )
  332. Q3ViewerCursorChanged            (TQ3ViewerObject         theViewer);
  333.  
  334.  
  335. /******************************************************************************
  336.  **                                                                             **
  337.  **        Returns the state of the viewer.  See the constant defined at the     **
  338.  **        top of this file.                                                     **
  339.  **                                                                             **
  340.  *****************************************************************************/
  341. EXTERN_API_C( unsigned long )
  342. Q3ViewerGetState                (TQ3ViewerObject         theViewer);
  343.  
  344. /******************************************************************************
  345.  **                                                                             **
  346.  **                            Clipboard utilities                                 **
  347.  **                                                                             **
  348.  *****************************************************************************/
  349. EXTERN_API_C( OSErr )
  350. Q3ViewerClear                    (TQ3ViewerObject         theViewer);
  351.  
  352. EXTERN_API_C( OSErr )
  353. Q3ViewerCut                        (TQ3ViewerObject         theViewer);
  354.  
  355. EXTERN_API_C( OSErr )
  356. Q3ViewerCopy                    (TQ3ViewerObject         theViewer);
  357.  
  358. EXTERN_API_C( OSErr )
  359. Q3ViewerPaste                    (TQ3ViewerObject         theViewer);
  360.  
  361.  
  362. /******************************************************************************
  363.  **                                                                             **
  364.  **                            New Event Model                                     **
  365.  **                                                                             **
  366.  *****************************************************************************/
  367. EXTERN_API_C( Boolean )
  368. Q3ViewerMouseDown                (TQ3ViewerObject         theViewer,
  369.                                  long                     x,
  370.                                  long                     y);
  371.  
  372. EXTERN_API_C( Boolean )
  373. Q3ViewerContinueTracking        (TQ3ViewerObject         theViewer,
  374.                                  long                     x,
  375.                                  long                     y);
  376.  
  377. EXTERN_API_C( Boolean )
  378. Q3ViewerMouseUp                    (TQ3ViewerObject         theViewer,
  379.                                  long                     x,
  380.                                  long                     y);
  381.  
  382. EXTERN_API_C( Boolean )
  383. Q3ViewerHandleKeyEvent            (TQ3ViewerObject         theViewer,
  384.                                  EventRecord *            evt);
  385.  
  386.  
  387. /******************************************************************************
  388.  **                                                                             **
  389.  **                                Drawing CallBack                             **
  390.  **                                                                             **
  391.  *****************************************************************************/
  392. EXTERN_API_C( OSErr )
  393. Q3ViewerSetDrawingCallbackMethod (TQ3ViewerObject         theViewer,
  394.                                  TQ3ViewerDrawingCallbackMethod  callbackMethod,
  395.                                  const void *            data);
  396.  
  397.  
  398. /******************************************************************************
  399.  **                                                                             **
  400.  **                                    Undo                                     **
  401.  **                                                                             **
  402.  *****************************************************************************/
  403. EXTERN_API_C( OSErr )
  404. Q3ViewerUndo                    (TQ3ViewerObject         theViewer);
  405.  
  406. EXTERN_API_C( Boolean )
  407. Q3ViewerGetUndoString            (TQ3ViewerObject         theViewer,
  408.                                  char *                    str,
  409.                                  unsigned long *        cnt);
  410.  
  411.  
  412. /******************************************************************************
  413.  **                                                                             **
  414.  **                                Camera Support                                 **
  415.  **                                                                             **
  416.  *****************************************************************************/
  417. EXTERN_API_C( OSErr )
  418. Q3ViewerGetCameraCount            (TQ3ViewerObject         theViewer,
  419.                                  unsigned long *        cnt);
  420.  
  421. EXTERN_API_C( OSErr )
  422. Q3ViewerSetCameraByNumber        (TQ3ViewerObject         theViewer,
  423.                                  unsigned long             cameraNo);
  424.  
  425. EXTERN_API_C( OSErr )
  426. Q3ViewerSetCameraByView            (TQ3ViewerObject         theViewer,
  427.                                  TQ3ViewerCameraView     viewType);
  428.  
  429. #endif  /* TARGET_OS_MAC */
  430.  
  431.  
  432.  
  433.  
  434.  
  435. #if PRAGMA_ENUM_ALWAYSINT
  436.     #pragma enumsalwaysint reset
  437. #elif PRAGMA_ENUM_OPTIONS
  438.     #pragma option enum=reset
  439. #elif defined(PRAGMA_ENUM_PACK__QD3DVIEWER__)
  440.     #pragma options(pack_enums)
  441. #endif
  442.  
  443. #if PRAGMA_STRUCT_ALIGN
  444.     #pragma options align=reset
  445. #elif PRAGMA_STRUCT_PACKPUSH
  446.     #pragma pack(pop)
  447. #elif PRAGMA_STRUCT_PACK
  448.     #pragma pack()
  449. #endif
  450.  
  451. #ifdef PRAGMA_IMPORT_OFF
  452. #pragma import off
  453. #elif PRAGMA_IMPORT
  454. #pragma import reset
  455. #endif
  456.  
  457. #ifdef __cplusplus
  458. }
  459. #endif
  460.  
  461. #endif /* __QD3DVIEWER__ */
  462.  
  463.